<template>
 <div>
     <h1>我是父组件</h1>
     <h3>{{msg}}</h3>
     <!-- 自定义事件 -->
     <Son @sendData="sendData($event)"></Son>
 </div>
</template>

<script>
// 导入子组件
import Son from './Son.vue'
export default {
    data(){
         return{
             msg:'666'
         }
    },
    created(){},
    methods:{
        sendData(val){
            console.log(val)
            console.log('被调用了')
            this.msg = val
        }
    },
    components:{
        Son
    }
}

</script>
<style scoped>
</style>